
-- ----------------------------
-- Table structure for TENANT_INFO
-- ----------------------------
CREATE TABLE "SYSTEM"."TENANT_INFO" (
  "ID" NUMBER(20,0) NOT NULL,
  "KP" NVARCHAR2(128) NOT NULL,
  "TENANT_ID" NVARCHAR2(128),
  "TENANT_NAME" NVARCHAR2(128),
  "TENANT_DESC" NVARCHAR2(256),
  "CREATE_SOURCE" NVARCHAR2(32),
  "GMT_CREATE" NUMBER(20,0) NOT NULL,
  "GMT_MODIFIED" NUMBER(20,0) NOT NULL
)
LOGGING
NOCOMPRESS
PCTFREE 10
INITRANS 1
STORAGE (
  INITIAL 65536 
  NEXT 1048576 
  MINEXTENTS 1
  MAXEXTENTS 2147483645
  FREELISTS 1
  FREELIST GROUPS 1
  BUFFER_POOL DEFAULT
)
PARALLEL 1
NOCACHE
DISABLE ROW MOVEMENT
;
COMMENT ON COLUMN "SYSTEM"."TENANT_INFO"."ID" IS 'id';
COMMENT ON COLUMN "SYSTEM"."TENANT_INFO"."KP" IS 'kp';
COMMENT ON COLUMN "SYSTEM"."TENANT_INFO"."TENANT_ID" IS 'tenant_id';
COMMENT ON COLUMN "SYSTEM"."TENANT_INFO"."TENANT_NAME" IS 'tenant_name';
COMMENT ON COLUMN "SYSTEM"."TENANT_INFO"."TENANT_DESC" IS 'tenant_desc';
COMMENT ON COLUMN "SYSTEM"."TENANT_INFO"."CREATE_SOURCE" IS 'create_source';
COMMENT ON COLUMN "SYSTEM"."TENANT_INFO"."GMT_CREATE" IS '创建时间';
COMMENT ON COLUMN "SYSTEM"."TENANT_INFO"."GMT_MODIFIED" IS '修改时间';
COMMENT ON TABLE "SYSTEM"."TENANT_INFO" IS 'tenant_info';

-- ----------------------------
-- Records of TENANT_INFO
-- ----------------------------
COMMIT;
COMMIT;

-- ----------------------------
-- Primary Key structure for table TENANT_INFO
-- ----------------------------
ALTER TABLE "SYSTEM"."TENANT_INFO" ADD CONSTRAINT "SYS_C0012441" PRIMARY KEY ("ID");

-- ----------------------------
-- Checks structure for table TENANT_INFO
-- ----------------------------
ALTER TABLE "SYSTEM"."TENANT_INFO" ADD CONSTRAINT "SYS_C0012426" CHECK ("ID" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
ALTER TABLE "SYSTEM"."TENANT_INFO" ADD CONSTRAINT "SYS_C0012427" CHECK ("KP" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
ALTER TABLE "SYSTEM"."TENANT_INFO" ADD CONSTRAINT "SYS_C0012428" CHECK ("GMT_CREATE" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
ALTER TABLE "SYSTEM"."TENANT_INFO" ADD CONSTRAINT "SYS_C0012429" CHECK ("GMT_MODIFIED" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;

-- ----------------------------
-- Indexes structure for table TENANT_INFO
-- ----------------------------
CREATE INDEX "SYSTEM"."IDX_TENANT_ID"
  ON "SYSTEM"."TENANT_INFO" ("TENANT_ID" ASC)
  LOGGING
  VISIBLE
PCTFREE 10
INITRANS 2
STORAGE (
  INITIAL 65536 
  NEXT 1048576 
  MINEXTENTS 1
  MAXEXTENTS 2147483645
  FREELISTS 1
  FREELIST GROUPS 1
  BUFFER_POOL DEFAULT
);
CREATE UNIQUE INDEX "SYSTEM"."UK_TENANT_INFO_KPTENANTID"
  ON "SYSTEM"."TENANT_INFO" ("KP" ASC, "TENANT_ID" ASC)
  LOGGING
  VISIBLE
PCTFREE 10
INITRANS 2
STORAGE (
  INITIAL 65536 
  NEXT 1048576 
  MINEXTENTS 1
  MAXEXTENTS 2147483645
  FREELISTS 1
  FREELIST GROUPS 1
  BUFFER_POOL DEFAULT
);

-- ----------------------------
-- Triggers structure for table TENANT_INFO
-- ----------------------------
CREATE TRIGGER "SYSTEM"."TG_TENANT_INFO" BEFORE INSERT ON "SYSTEM"."TENANT_INFO" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW 
begin
select /*序列*/SEQ_TENANT_ID.nextval into:new.ID/*主键*/ from dual;
-- select /*序列*/seq_test.nextval into:new.id/*主键*/ from dual;
end;
/
